﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using QMERP.Domain.Entities;

namespace QMERP.Infrastructure.EFCore.Mappings
{
    public class Contract_LensMapping : IEntityTypeConfiguration<Contract_Lens>
    {
        public void Configure(EntityTypeBuilder<Contract_Lens> builder)
        {
            builder.Property(x => x.MinSPH);
            builder.Property(x => x.MaxSPH);
            builder.Property(x => x.MinCYL);
            builder.Property(x => x.MaxCYL);
            builder.Property(x => x.MinADD);
            builder.Property(x => x.MaxADD);
            builder.Property(x => x.Size).IsRequired(false).HasMaxLength(700);
            builder.Property(x => x.PricePcs).HasPrecision(18, 2);
            builder.Property(x => x.PricePairs).HasPrecision(18, 2);
            builder.Property(x => x.InvoiceStrENG).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.InvoiceStrCHS).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.InvoiceStrCHT).IsRequired(false).HasMaxLength(200);

            builder.Property(x => x.ContractId);
            builder.Property(x => x.LensId);

            builder.HasIndex(x => x.Id);
            builder.HasIndex(x => x.ContractId);
            builder.HasIndex(x => x.LensId);
        }
    }
}
